package org.cmy.po;

import javax.persistence.*;
import lombok.Data;

import java.util.HashSet;
import java.util.Set;

// 角色
@Entity
@Data
public class Role {
    @Id
    private Long id;
    private String name; // e.g., "ROLE_ADMIN"

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(
        name = "role_permission",
        joinColumns = @JoinColumn(name = "role_id"),
        inverseJoinColumns = @JoinColumn(name = "permission_id")
    )
    private Set<Permission> permissions = new HashSet<>();
}